/**
 * 
 */
package org.istt.service;

import java.util.Date;
import java.util.List;

import org.istt.domain.FileManagement;
import org.istt.domain.User;
import org.istt.web.helper.ExtendedPaginatedList;

/**
 * @author Huy
 *
 */
public interface FileMgrManager extends Manager<FileManagement, Long> {
	
	/**
	 * get the list of files according to field ID, content and returned date
	 * @param fieldId the field Id
	 * @param content the content of the file
	 * @param toDate the returned date
	 * @return list of file
	 */
	List<List<Object>> search(Long fieldId, String content, Date toDate);
	List<FileManagement> searchFileMgrs(String fileId, Boolean activeStatus, Integer position);
	
	/**
	 * Get the number of files that included in
	 * @param fileId
	 * @return the number of files
	 */
	int countByFileId(String fileId);
	
	/**
	 * Update process status of a file to the end 
	 * @param fileIds an array of file identity
	 * @param approver the approver
	 */
	void updateToEndStatus(String[] fileIds, String[] fmgrIds, User approver);
	
	/**
	 * Roll back a step
	 * @param currentStepId
	 * @param previousStepId
	 */
	void rollback(Long currentStepId, Long previousStepId);
	
	/**
	 * Get the list of amendment file
	 * @return the list of file management
	 */
	ExtendedPaginatedList getAmendmentFile(Long userId, ExtendedPaginatedList paginatedList);
	
	int getAmendmentFileRecordCount(Long userId);
	
	/**
	 * Remove all the file marked with approve status equal to false
	 * @param ids
	 */
	void removeAmendment(Long[] ids);

	/**
	 * Get current step number
	 * @param fileId
	 * @return
	 */
	int getCurrentStep(String fileId);
	
	/**
	 * Get current step processing
	 * @param fileId
	 * @return
	 */
	FileManagement getCurrentStepProcess(String fileId);
}
